No route matches [PUT] error in active_admin

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2012-10-04T19:56:54Z Indexed on 2012/10/04 21:38 UTC
Read the original article Hit count: 101

Filed under:
|

in active_admin partials created a form input:

<%= semantic_nested_form_for @item, :url => admin_items_path(@item) do |f| %>
  <fieldset class="inputs">
  <ol>
    <%= f.input :category %></br>
    <%= f.input :title  %>
  <%= f.input :photo1 %>
  <%= f.input :photo2 %>
</ol>
</fieldset>
  <%= f.fields_for :ItemColors do |i| %>
    <fieldset class="inputs">
      <ol>
    <%= i.input :DetailColor %>
    <%= i.input :size,  :input_html => { :size => "10" } %>
    <%= i.link_to_remove "remove" %>
  </ol>
</fieldset>
  <% end %>
  <%= f.link_to_add "add", :ItemColors %>
  <%= f.actions %>
<% end %>

to create a new Item okay creates and throws On the New Item, but if I do update an existing item is routed to an error occurs while such a path exists:

No route matches [PUT] "/admin/items.150" #150 is item_id

rake routes:

batch_action_admin_items POST   /admin/items/batch_action(.:format)   admin/items#batch_action
admin_items GET                 /admin/items(.:format)                admin/items#index
POST                            /admin/items(.:format)                admin/items#create
new_admin_item GET              /admin/items/new(.:format)            admin/items#new
edit_admin_item GET             /admin/items/:id/edit(.:format)       admin/items#edit
admin_item GET                  /admin/items/:id(.:format)            admin/items#show
PUT                             /admin/items/:id(.:format)            admin/items#update
DELETE                          /admin/items/:id(.:format)            admin/items#destroy

help to solve this problem

UPD

I found the error, but not yet understood how to fix it

the upgrade is a request:

PUT "/admin/items"

but should:

PUT "/admin/items/some_id"

any ideas?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about routing